-
Notifications
You must be signed in to change notification settings - Fork 917
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Workspace] Add a workspace client in workspace plugin #6094
[Workspace] Add a workspace client in workspace plugin #6094
Conversation
898e80b
to
5a8a728
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6094 +/- ##
==========================================
+ Coverage 67.13% 67.14% +0.01%
==========================================
Files 3324 3326 +2
Lines 64330 64394 +64
Branches 10347 10358 +11
==========================================
+ Hits 43188 43239 +51
- Misses 18618 18626 +8
- Partials 2524 2529 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
b81b5cd
to
37e9793
Compare
37e9793
to
9b21ba0
Compare
* Check if provided workspace id exists, | ||
* update the currentWorkspaceId$ if it exists. | ||
*/ | ||
public async enterWorkspace(id: string): Promise<IResponse<null>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it better to call it updateCurrentWorkspace then? Not sure if anyone using it would understand what does enterWorkspace mean if not looking at the code or doc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currentWorkspace$ will be updated as a derived value in https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/src/core/public/workspace/workspaces_service.ts#L56. So for the workspace client it does not need to update explicitly. Would it be better that we update the doc to like
Check if provided workspace id exists in the storage and update core.currentWorkspaceId$ if it exists
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when will we use this method? is it when user tries to go inside a workspace?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will use that in setup lifeCycle of workspace plugin when user visit the page with pattern match /w/${workspaceId}/xxx
, which will validate if the workspaceId exists and change the currentWorkspaceId$
if it does.
56ba159
to
56d4113
Compare
@BionIT Could you please take a look here to see if all the comments have been addressed? |
Signed-off-by: SuZhou-Joe <[email protected]>
Signed-off-by: SuZhou-Joe <[email protected]>
Signed-off-by: SuZhou-Joe <[email protected]>
Signed-off-by: SuZhou-Joe <[email protected]>
Signed-off-by: SuZhou-Joe <[email protected]>
Signed-off-by: SuZhou-Joe <[email protected]>
Signed-off-by: SuZhou-Joe <[email protected]>
866d2e0
to
65fc363
Compare
* Check if provided workspace id exists, | ||
* update the currentWorkspaceId$ if it exists. | ||
*/ | ||
public async enterWorkspace(id: string): Promise<IResponse<null>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when will we use this method? is it when user tries to go inside a workspace?
…oject#6094) * feat: add comment Signed-off-by: SuZhou-Joe <[email protected]> * feat: update unit test Signed-off-by: SuZhou-Joe <[email protected]> * feat: add CHANGELOG Signed-off-by: SuZhou-Joe <[email protected]> * feat: optimize comment Signed-off-by: SuZhou-Joe <[email protected]> * feat: optimize comment Signed-off-by: SuZhou-Joe <[email protected]> * feat: optimize code Signed-off-by: SuZhou-Joe <[email protected]> * feat: optimize code Signed-off-by: SuZhou-Joe <[email protected]> --------- Signed-off-by: SuZhou-Joe <[email protected]> Signed-off-by: Hailong Cui <[email protected]>
* Add workspacePluginSetup type Signed-off-by: Hailong Cui <[email protected]> * add fakenews.co to .lycheeexclude Signed-off-by: Hailong Cui <[email protected]> * [Workspace] Add a workspace client in workspace plugin (#6094) * feat: add comment Signed-off-by: SuZhou-Joe <[email protected]> * feat: update unit test Signed-off-by: SuZhou-Joe <[email protected]> * feat: add CHANGELOG Signed-off-by: SuZhou-Joe <[email protected]> * feat: optimize comment Signed-off-by: SuZhou-Joe <[email protected]> * feat: optimize comment Signed-off-by: SuZhou-Joe <[email protected]> * feat: optimize code Signed-off-by: SuZhou-Joe <[email protected]> * feat: optimize code Signed-off-by: SuZhou-Joe <[email protected]> --------- Signed-off-by: SuZhou-Joe <[email protected]> Signed-off-by: Hailong Cui <[email protected]> * Revert "add fakenews.co to .lycheeexclude" This reverts commit 55f6344. Signed-off-by: Hailong Cui <[email protected]> * Add WorkspacePluginStart Signed-off-by: Hailong Cui <[email protected]> --------- Signed-off-by: Hailong Cui <[email protected]> Signed-off-by: SuZhou-Joe <[email protected]> Co-authored-by: SuZhou-Joe <[email protected]>
…oject#6094) * feat: add comment Signed-off-by: SuZhou-Joe <[email protected]> * feat: update unit test Signed-off-by: SuZhou-Joe <[email protected]> * feat: add CHANGELOG Signed-off-by: SuZhou-Joe <[email protected]> * feat: optimize comment Signed-off-by: SuZhou-Joe <[email protected]> * feat: optimize comment Signed-off-by: SuZhou-Joe <[email protected]> * feat: optimize code Signed-off-by: SuZhou-Joe <[email protected]> * feat: optimize code Signed-off-by: SuZhou-Joe <[email protected]> --------- Signed-off-by: SuZhou-Joe <[email protected]>
…oject#6094) (#308) * feat: add comment * feat: update unit test * feat: add CHANGELOG * feat: optimize comment * feat: optimize comment * feat: optimize code * feat: optimize code --------- Signed-off-by: SuZhou-Joe <[email protected]>
* feat: add comment Signed-off-by: SuZhou-Joe <[email protected]> * feat: update unit test Signed-off-by: SuZhou-Joe <[email protected]> * feat: add CHANGELOG Signed-off-by: SuZhou-Joe <[email protected]> * feat: optimize comment Signed-off-by: SuZhou-Joe <[email protected]> * feat: optimize comment Signed-off-by: SuZhou-Joe <[email protected]> * feat: optimize code Signed-off-by: SuZhou-Joe <[email protected]> * feat: optimize code Signed-off-by: SuZhou-Joe <[email protected]> --------- Signed-off-by: SuZhou-Joe <[email protected]> (cherry picked from commit 4b89ad0) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md
…#6409) * [Workspace] Add a workspace client in workspace plugin (#6094) * feat: add comment Signed-off-by: SuZhou-Joe <[email protected]> * feat: update unit test Signed-off-by: SuZhou-Joe <[email protected]> * feat: add CHANGELOG Signed-off-by: SuZhou-Joe <[email protected]> * feat: optimize comment Signed-off-by: SuZhou-Joe <[email protected]> * feat: optimize comment Signed-off-by: SuZhou-Joe <[email protected]> * feat: optimize code Signed-off-by: SuZhou-Joe <[email protected]> * feat: optimize code Signed-off-by: SuZhou-Joe <[email protected]> --------- Signed-off-by: SuZhou-Joe <[email protected]> (cherry picked from commit 4b89ad0) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md * fix: unit test Signed-off-by: SuZhou-Joe <[email protected]> --------- Signed-off-by: SuZhou-Joe <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Add workspacePluginSetup type Signed-off-by: Hailong Cui <[email protected]> * add fakenews.co to .lycheeexclude Signed-off-by: Hailong Cui <[email protected]> * [Workspace] Add a workspace client in workspace plugin (#6094) * feat: add comment Signed-off-by: SuZhou-Joe <[email protected]> * feat: update unit test Signed-off-by: SuZhou-Joe <[email protected]> * feat: add CHANGELOG Signed-off-by: SuZhou-Joe <[email protected]> * feat: optimize comment Signed-off-by: SuZhou-Joe <[email protected]> * feat: optimize comment Signed-off-by: SuZhou-Joe <[email protected]> * feat: optimize code Signed-off-by: SuZhou-Joe <[email protected]> * feat: optimize code Signed-off-by: SuZhou-Joe <[email protected]> --------- Signed-off-by: SuZhou-Joe <[email protected]> Signed-off-by: Hailong Cui <[email protected]> * Revert "add fakenews.co to .lycheeexclude" This reverts commit 55f6344. Signed-off-by: Hailong Cui <[email protected]> * Add WorkspacePluginStart Signed-off-by: Hailong Cui <[email protected]> --------- Signed-off-by: Hailong Cui <[email protected]> Signed-off-by: SuZhou-Joe <[email protected]> Co-authored-by: SuZhou-Joe <[email protected]> (cherry picked from commit 9cdc7c9) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Add workspacePluginSetup type * add fakenews.co to .lycheeexclude * [Workspace] Add a workspace client in workspace plugin (#6094) * feat: add comment * feat: update unit test * feat: add CHANGELOG * feat: optimize comment * feat: optimize comment * feat: optimize code * feat: optimize code --------- * Revert "add fakenews.co to .lycheeexclude" This reverts commit 55f6344. * Add WorkspacePluginStart --------- (cherry picked from commit 9cdc7c9) Signed-off-by: Hailong Cui <[email protected]> Signed-off-by: SuZhou-Joe <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: SuZhou-Joe <[email protected]>
Description
This PR mainly introduces a workspace client to perform CRUD operations request to server side and gives some useful utils function.
Issues Resolved
closes #6093
Screenshot
As the changes only happen in a frontend client, there is no screenshot for that.
Testing the changes
src/plugins/workspace/public/plugin.ts
workspaceClient.create
,workspaceClient.delete
and so on, it should making http request to server accordingly in browser side.Check List
yarn test:jest
yarn test:jest_integration